ZX Spectrum Tape Loader - Documentation - 26.Feb.95 KIO !
This program reads ZX Spectrum program and data tapes and stores them as tape files on your hard disk.
Contents
** Legal stuff
** System requirements
** How to use the program
** Description of the generated files
** History
Legal stuff
** ZX Loader
Copyright (C) 1994
Günter Woigk
Nürnberger Str. 79
91052 Erlangen
Germany
email: ea215@fim.uni-erlangen.de
All rights reserved
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
System requirements
• System 7
• Color QuickDraw
• up to 10MB free on HD for scratch file (AIFF sound file)
If you encounter problems, mail me a bug report
If you don't encounter problems, mail me a yee-it-works-on-my-xxx
If you solve problems by modifying the included source, mail me your modifications
Instructions
I hope, there is no general problem in handling the program. Menu entries are self-explaining. In general, most options in the options menu should not be altered. Position and size of the windows may be modified using ResEdit to fit the size of your monitor; ZX Loader does not save preferences. All files are automatically saved and are not deleted by the program. Especially the AIFF files should be trashed quickly, for they tend to be huge (megabytes).
To record a 'standard' program of 40 kilobytes, 5 megabyte free space on the hard disk are required. The space is mostly needed for the AIFF file and therefore delete the AIFF files when you have converted a tape.
To record a new tape select 'New' from the 'File' menu. Select a destination file name in the file selector box that pops up and then you get the standard Macintosh sound recording window. The sound is directly written to harddisk without buffering in RAM, so you may record 30 minutes of sound occupying 40 megabytes of harddisk space ...
Unfortunatelly i couldn't implement a Specci-like optical control of the input signal, so finding the right setting for volume, bass and trebble at your tape recorder may be a little bit more time consuming.
After that, ZX Loader displays the signal level distribution if you have switched on this option (it is off by default).
You also may load AIFF files using 'Open' in the 'File' menu.
Then you will start exactly at this point:
Now the data is run length compressed. A window showing the distribution of run lengths with high and low signal levels is displayed if you haven't deselected this option. You should see two easyly distinguishable areas representing the 0- and 1-bits. The run length of the synchronizing sequence is only a little bit longer than that for 1-bits, so they are in most cases obscured by the 1-bits. Only in very short programs they become evident. To get a feeling for this display, record some short sequences of data and/or of the synchonizing sequence. The result of this procedure is a file ending on '.rles', meaning 'run length encoded square wave signal'.
You also may load RLES files using 'Open' in the 'File' menu.
Then you will start exactly here:
Now the data is decoded. If you haven't disabled this option, the procedure is shown in the ZX Spectrum window featuring red-white and blue-yellow striped border. If pictures are recognized, they are displayed. Even flashing colors are supported (I like Manic Miner). If you resize this window using ResEdit, only the width of the border will be affected.
All progress is monitored in the log window and you may select 3 levels of verbosity. All decoded data is written to a file ending on .tape. This file, it's creator is set to 'ZXSP' and it's type is 'Tape', is the currently supported format for the ZX Spectrum Emulator and the final output of all conversions. You may delete the AIFF and the RLES file, but if you delete the TAPE file, you will have to start all over again.
Notes
If the data cannot be properly decoded, you will get error messages. Then you must adjust volume, bass and trebble at your tape recorder. ZX Loader sets the sound input to mono, 8 bit depth and 22 kHz sampling frequency. At least, it tries. If it fails, ZX Loader cannot decode the AIFF file recorded by itself and you have to modify and recompile the program.
ZX Loader can decode any program and data which was saved with the original low level tape writing routines of the ZX Spectrum. This means, the timing of synchronizing header and pulse and of 0 and 1 bits must be the same. Any program using custom loading routines as a copy protection cannot be decoded. On the other hand, illegal block type, long header, headerless and so on are ok.
The converted data remain specific to the ZX Spectrum. Converted programs contain Spectrum Basic tokens or Z80 machine code. Only text files may be imported into a friendly text editor where you may remove some funny chars and save the rest as a plain text file. Screenshots cannot be exported from ZX Loader but this function is implemented in my ZX Spectrum Emulator named Mac Spectacle (separate program).
Generated Files
An uncompressed Apple-IFF sound file
File type 'AIFF', suffix '.aiff'
This file can be played with many PD programs (if you like that noise). They are huge: More than one megabyte per minute. They can be deleted after conversion. They consist of a header followed by raw sound data. I have no information about the header and treat it just like data. Maybe ZX Loader thinks it's some kind of noise...
A run length encoded square wave sound file
File type 'RLES', suffix '.rles'
Length is factor 8 to 10 of the contained data. It contains all information of the tape a real ZX Spectrum can decode.
Each byte contains in it's upper nibble the run length of the audio signal in the range 0 ... +127 and in the lower nibble the run length in the range -1 ... -128. Encodeable run lengths are 3 samples (nibble=0) to 18 samples (nibble=15). any shorter period will look like a period of 3 samples and any longer period will look like a period of 18 samples. The run lengths of the signals generated by the ZX Spectrum tape storing routines are in the range 5 to 15.
The final tape file
File type 'Tape' and suffix '.tape'
The result of the conversion. This file contains a '1 byte per byte' representation of the saved data plus administrative headers. The size of this file is nearly the same as the size of the data it contains.
Encoding of the tape files:
A tape file consists of a sequence of data blocks, each containing a data block from the ZX Spectrum program tape:
dc.w length // 2 byte data length
dc.b ZX_Spectrum_data ....
The length is the total length of the ZX Spectrum data block without the length word itself. The byte order is little endian (like intel or Z80) and so we have to swap the two bytes any time we read or write them to mc68000 registers.
The ZX_Spectrum_data are the data bytes from one ZX Spectrum data block.
A ZX Spectrum data block may be a HEADER BLOCK or a DATA BLOCK or a block with an illegal identification byte. Normally a program is saved in two ZX Spectrum data blocks: first a header block, telling the loader: this is a program, and then a data block, containing the program. A little bit confusing, but i have a problem naming them all...
The ZX_Spectrum_data include:
1 byte identification, saying this is a header or this is data
n bytes data. if it's a header block, these are 16 bytes.
1 byte checksum
n bytes padding data. normally none.
History
Version 1.0.0
Startet work on ZX Loader at 01.Jul.94
Version 1.0.1
Killed my audio input with high voltage on protective ground
Virtually nothing is impossible!
First public release
Bach composed masterpieces being deaf
Version 1.0.2
Added international (english) localization
Version 1.0.3
Replaced old tape file format with .tap file format
(same as used in the PC based ZX Spectrum emulator Z80 by Gerton Lunter)
Added code that switches sound input to mono/8bit/22kHz
Version 1.0.4
Compiled with Metrowerk C; now 68k and PPC version
removed a bug in the sound input setup routine (which curiously didn't show up in the Think C version)